<h1 class="right">تقارير حركة العملاء</h1>
<div class="clear"></div>

<div id="dashboard-container">
	<div class="customers-filter">
    	<form name="contract_search" action="" method="POST" id="searchClient">
      <table class="bookings-filter" >
        	
          <tr>
            
            	<td>رقم الإثبات  &nbsp;:&nbsp;<input type="text" class="small-input identify" name="id" placeholder="" value="<?php if(isset($binds['id']) ) { echo $binds['id']; } ?>" /></td>
              <td>الاسم&nbsp;:&nbsp;<input type="text" class="small-input" name="name" placeholder="" value="<?php if(isset($binds['name']) ) { echo $binds['name'];} ?>" /></td>
              <td>جوال&nbsp;:&nbsp;<input type="text" class="small-input" name="mobile" placeholder="" value="<?php if(isset($binds['mobile']) ) { echo $binds['mobile']; }?>" /></td>
               
                
				
               <td></td><td></td><td></td>
               <td style="width:50px">
                  <input type="hidden" name="filteration" value="4"/> <!-- 4 for reciept Reposts -->
                  <a href="#"><div class="export-button">تصدير Excel</div></a>
                  
                  <input type="hidden" id="pdf_excel" name="pdf_excel" value="0"/>
                </td>
                <td style="width:50px"><a href="#"><div class="export-PDF">تصدير PDF</div></a></td>
                <td style="width:50px"><div class="search-botton">بحث</div></td>
                
            </tr>
            
      </table>
      </form>
    </div>
    
    
    <div class="dashboard-row">
    
    	<table class="customers-table">
        	<thead>
            <tr class="customers-table-head">
            	<td width="">اسم العميل</td>
              <td width="">الوحده</td>
              <td width="">رقم العقد</td>
              <td width="">دخول فى</td>
              <td width="">خروج فى</td>
              <td width="">المده</td>
			  <td width="">الاجمالى </td>
			  <td width="">المدفوع</td>
			  <td width="">المتبقى</td>
		
            </tr>
            </thead>
            
            <?php foreach($contracts as $contract) {?>
                <tr class="">
                    <td width=""><?php echo $contract['name']; ?></td>
                    <td class="blue" width=""><?php echo $contract['apartment_name']; ?></td>
                    <td width=""><?php echo $contract['contract_id']; ?></td>
                    <td width=""><?php echo $contract['mildai_from']; ?></td>
                    <td width=""><?php echo $contract['miladi_out']; ?></td>
                    <td class="" width=""> <?php  echo $contract['period']; ?> </td>
                    <td width=""><?php
                    $price_discounted = $contract['total'] - ( ( ($contract['discount'] + $contract['co_discount']))  ) - $contract['fixed_discount'];
                    echo $price_discounted + $contract['services_revenue']; 
                    ?>
                    </td>
                    <td width=""> 
                    <?php
                    echo $contract['paid']; 
                    ?> 
                    </td>
                    <td width=""> <?php echo $price_discounted + $contract['services_revenue']-$contract['paid'] ; ?> </td>
					
                </tr>
             
            <?php }  ?>
        </table><br />
        <hr />
        <?php
          $start = $page * 20 -19;
          $end  = $start + 19;
          if($end > $totalPages)
            $end = $totalPages;
          
        ?>
        <?php if(!empty($contracts)) { ?>
        <div class="clear"></div>
        <div class="relative">
          <div id="contracts-selection" class="center"></div>
          <span class="middle xsmall showing-results absolute">عرض النتائج <?php echo $start; ?> - <?php echo $end; ?> من إجمالى <?php echo $totalPages; ?></span>
        </div> 

        <div class="hidden totalPages"><?php if(isset($totalPages)) {echo $totalPages;} ?></div>
        <div class="hidden currentPage"><?php if(isset($page)) {echo $page;} ?></div>
        <?php } ?>
    </div>
    <hr />
    
  <div class="clear"></div>
  </div>
</div>        
